﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1.NewFolder1
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
                UnobtrusiveValidationMode = UnobtrusiveValidationMode.None;
            
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string Uname = uname.Text;
            string upwd = pwd.Text;
            string Question = DropDownList1.Text;
            string Answer = ans.Text;
            string Email = Eamil.Text;
            int Cellp = int.Parse(cell.Text);
            if (sex1.Checked)
            {
                string sex = sex1.Text;
            }
            else 
            {
                string sex = sex2.Text;
            }
            string major = DropDownList2.Text;



            string sql = $"insert into Uesrinfo(Uname,Upwd)values('{Uname}','{upwd}')";
            string Constr = "server=.;uid=sa;pwd=123456;database=Userinfo";
            SqlConnection con = new SqlConnection(Constr);
            con.Open();
            SqlCommand cmd = new SqlCommand(sql,con);
           
            int re = cmd.ExecuteNonQuery();
            if (re > 0)
            {
                Label1.Text = "注册成功";
            }
            else 
            {
                Label1.Text = "注册成功";
            }
            con.Close();
        }
    }
}